#pragma once

#include "Tree.h"

namespace Tmpl {

class CurveGraph;
class Slider;
class Tabs;
class WidgetSet;
class LabeledSet;
class OrdenedSet;
class SelectList;
class Button;
class CheckBox;
class TreeCreator
{
public:
	TreeCreator();
	~TreeCreator();

	void SetPos(int x, int y);
	void SetSize(int w, int h);

	void Tick(float dt);
	void Draw();

	Tree* GetTree(){return mTree;}
	TreeSettings& GetSettings(){return mSettings;}
private:
	void BuildBranchListSub(const TreeBranchSettings* branch, std::string prefix);
	void BuildBranchList();
	void DeleteBranch(TreeBranchSettings* in, int& current, int deleteIdx);
	TreeBranchSettings* GetBranch(TreeBranchSettings* in, int& current, int getIdx);

	Tree* mTree;
	TreeSettings mSettings;
	TreeBranchSettings* mBranch;
	Vec2i mPos;

	// GUI
	Tabs* mTabs;

	//----- Stem ----//
	// stem
	OrdenedSet* mTabStem;

	LabeledSet* mTabStemAxis;
	Slider* mTabStemAxisLength;
	Slider* mTabStemAxisVariation;
	Slider* mTabStemAxisResolution;
	Slider* mTabStemAxisBending;
	CurveGraph* mTabStemAxisLightInfluence;

	LabeledSet* mTabStemRendering;
	Slider* mTabStemRenderingRadius;
	CurveGraph* mTabStemRenderingProfile;
	Slider* mTabStemRenderingResolution;
	Slider* mTabStemRenderingSegments;

	// Branching
	OrdenedSet* mTabBranching;

	CurveGraph* mTabBranchingOffsetInfluence;
	CheckBox* mTabBranchingInheritRadius;
	Slider* mTabBranchingOffsetMin;
	Slider* mTabBranchingOffsetMax;
	Slider* mTabBranchingBranches;
	Slider* mTabBranchingAxisVariation;

	// Material

	//----- Leaves ----//

	//----- Tree ---//
	OrdenedSet* mTreeSet;
	OrdenedSet* mTreeSetBranchButtons;
	Button* mTreeSetNewSeed;
	Button* mTreeSetBranchAdd;
	Button* mTreeSetBranchDelete;
	SelectList* mTreeSetOverview;
};

}; // namespace Tmpl